package com.training.java.core.homework04;

// Base class for Laptop and Desktop. In Laptop, upgrade() method is overridden and in Desktop it is not.
public class Computer {

	// Variables
	private boolean powerOn;
	private double memory;
	private double diskCapacity;

	private double maxMemory = 4;
	private double maxDiskCapacity = 100;

	// Methods
	Computer() {
		this.powerOn = false; // instantiate with a default of false
		this.memory = maxMemory;
		this.diskCapacity = maxDiskCapacity;
	}

	public void start() {
		if (this.powerOn == false) {
			this.powerOn = true;
		}
	}

	public void stop() {
		if (this.powerOn == true) {
			this.powerOn = false;
		}
	}

	public void upgrade(double maxMemory, double maxDiskCapacity) {
		this.maxMemory = maxMemory;
		this.diskCapacity = maxDiskCapacity;
		
		System.out.println("Computer has been upgraded to, memory = "
				+ getMaxMemory() + " GB" + " disk capacity = "
				+ getDiskCapacity() + " GB");
	}

	// Getters
	public boolean isPowerOn() {
		return this.powerOn;
	}

	public double getMemory() {
		return this.memory;
	}

	public double getDiskCapacity() {
		return this.diskCapacity;
	}

	public double getMaxMemory() {
		return this.maxMemory;
	}

	public double getMaxDiskCapacity() {
		return this.maxDiskCapacity;
	}
}
